package Code.AbstractClass.Demo1;

public  abstract class Person {
    private String name;
    private int age;

    //抽象类可以有构造方法
    //作用：当创建子类对象时，给属性进行赋值的
    public Person() {
    }

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public abstract void work();

    public void sleep(){
        //抽象类中不一定有抽象方法，但有抽象方法的一定是抽象类
        System.out.println("睡觉");
    }
}
